package model

import (
	"time"
)

const SettingOperationName = "setting_operation"

type SettingOperation struct {
	Id       int               `json:"id" orm:"auto" sql:"INT"`
	Name     map[string]string `json:"name" sql:"JSON"`
	Desc     map[string]string `json:"desc" sql:"JSON"`
	Icon     string            `json:"icon" sql:"VARCHAR"`
	IconType string            `json:"icon_type" sql:"VARCHAR"`

	Type     OperationType     `json:"type" sql:"TINYINT"`
	Key      string            `json:"key" sql:"VARCHAR"`
	NeedUnit bool              `json:"need_unit" sql:"TINYINT"`
	UnitType UnitOperationType `json:"unit_type" sql:"TINYINT"`
	Weight   int               `json:"weight" sql:"INT"`

	Target          []TargetSelect        `json:"target" sql:"JSON"`
	DirectDistance  bool                  `json:"direct_distance" sql:"TINYINT"`
	DistanceRequire *CompareGroupRelation `json:"distance_require" sql:"JSON"`
	InfoEvent       byte                  `json:"info_event" sql:"TINYINT"`

	Show           []uint                   `json:"show" sql:"JSON"`
	Require        CompareDataRelationSlice `json:"require" sql:"JSON"`
	UnitRequire    CompareDataRelationSlice `json:"unit_require" sql:"JSON"`
	TargetRequire  CompareDataRelationSlice `json:"target_require" sql:"JSON"`
	RelationSelect *RelationSelect          `json:"relation_select" sql:"JSON"`
	Params         []string                 `json:"params" sql:"JSON"`
	Default        []interface{}            `json:"default" sql:"JSON"`

	UseConsume DataRelationSlice `json:"use_consume" sql:"JSON"`

	UpdateTime *time.Time `json:"update_time" orm:"updateTime" sql:"DATETIME"`
}
